Java8 函数式接口一览
Function<String,String> fun = (x) -> {System.out.print(x+": ");return "Function";};
System.out.println(function.apply("hello world"));
Predicate<String> pre = (x) ->{System.out.print(x);return false;};
System.out.println(": "+pre.test("hello World"));
Consumer<String> con = (x) -> {System.out.println(x);};
con.accept("hello world");
Supplier<String> supp = () -> {return "Supplier";};
System.out.println(supp.get());
BinaryOperator<String> bina = (x,y) ->{System.out.print(x+" "+y);return "BinaryOperator";};
System.out.println(" "+bina.apply("hello ","world"));
自定义函数式
@FunctionalInterface